// ScreenWnd.cpp : implementation file
//

#include "stdafx.h"
#include "AVI_Player.h"
#include "ScreenWnd.h"
#include "def.h"


// CScreenWnd

IMPLEMENT_DYNAMIC(CScreenWnd, CWnd)

CScreenWnd::CScreenWnd()
{

}

CScreenWnd::~CScreenWnd()
{
}


BEGIN_MESSAGE_MAP(CScreenWnd, CWnd)
	ON_MESSAGE(WM_USER_DRAW, &CScreenWnd::OnUserDraw)
END_MESSAGE_MAP()


// CScreenWnd message handlers

LRESULT CScreenWnd::OnUserDraw(WPARAM p, LPARAM l)
{
	l = l;
	CBitmap bmp;
	BITMAP bmpinfo;

	bmp.CreateBitmap(lcddev_width, lcddev_height, 1, 32, (void*)p);
	bmp.GetObject(sizeof(bmpinfo),&bmpinfo);

	CDC * dc = GetDC();

	CDC dcc;
	dcc.CreateCompatibleDC(dc);
	dcc.SelectObject(&bmp);

	CRect rect;
	GetWindowRect(&rect);
	dc->StretchBlt(0,0,rect.Width(),rect.Height(),&dcc,0,0,bmpinfo.bmWidth,bmpinfo.bmHeight,SRCCOPY);

	ReleaseDC(dc);

	return 0;
}
